<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Profile Page</title>
<link rel="stylesheet" type="text/css" href="PersonalPage.css" />
</head>
<%@page import="entities.*"%>
<%@page import="java.util.*"%>
<%@page import="sessionbeans.FriendshipBean" %>
<%
	RegisteredUser user = (RegisteredUser) request.getSession()
			.getAttribute("visitinguser");
	List<Declares> abilities = (List<Declares>) request.getSession().getAttribute("visitinguserabilities");
	String friendshipState = (String)request.getSession().getAttribute("friendshipstate");
%>
<body style="background-color: #94C0D6">
	<img alt="" src="Swim.jpg" style="height: 64px; width: 200px;">
	<form
		style="background-color: #A6B0DB; border-bottom-width: thin; border-right-width: thin; border-left-width: thin; border-top-width: thin; border-top-color: #8080FF; border-right-color: #8080FF; border-top-style: solid; border-right-style: solid; height: 24px;">
		<a href="SearchServlet">Back.</a> <a href="LogOutServlet">Logout.</a>
	</form>
<form style="width: 453px; background-color: #8080FF; height: 22px; vertical-align: middle; border-top-style: solid; border-top-color: #8080C0; border-right-color: #8080C0; border-right-width: thin; border-right-style: solid; border-top-width: thin">
			<center><b><%
				out.print(user.getSurname() + " " + user.getName() + " (alias "
						+ user.getUserId() + ")");
			%></b></center>
</form>
	<fieldset style="width: 995px;">
		<div class=field style="width: 276px;">
			<form style="height: 164px; width: 172px">

				<a href="SendHelpRequestPage.jsp"><br> Send Help Request <br></a>
				<%
				if  (friendshipState.equals(FriendshipBean.CAN_SEND_REQUEST)) {
					out.print("<a href=\"SendFriendshipServlet?receiver=" + user.getUserId() + "&&sender=" + request.getSession().getAttribute("userId") + "\">" + friendshipState + "<br></a>");
					} else if(friendshipState.equals(FriendshipBean.PENDING_REQUEST)){
						out.println("<a href=\"PendingFriendshipServlet" + "\">" + friendshipState + "<br></a>");
						} else if(friendshipState.equals(FriendshipBean.REQUEST_SENT)){
							out.println(friendshipState);
						}%>			

				<a href="SendFeedbackPage.jsp">Send Feedback <br></a>
				
			</form>
		</div>
		<div class=field style="width: 276px;">
				<form class=form-inside
				style="width: 933px; height: 222px; list-style-type: disc">
				<fieldset style="width: 882px; background-color: #A6B0DB; border-bottom-style: none; border-top-style: none; border-left-style: none; border-right-style: none">
					<div class=field style="width: 276px; border-top-style: none; border-right-width: thin; border-right-style: none; border-top-width: thin">
						<table style="height: 83px; width: 256px; background-color: #8080C0; border-top-style: solid; border-top-color: #8080C0; border-right-color: #8080C0; border-right-width: thin; border-right-style: solid; border-top-width: thin">
							<tr>
								<td style="background-color: #8080FF">Personal Info</td>
							</tr>
							<tr>
								<td><b> E-mail:</b></td>
								<td>
									<%
										out.print(user.geteMail());
									%>
								</td>
							</tr>
							<tr>
								<td><b> Address:</b></td>
								<td>
									<%
										out.print(user.getAddress());
									%>
								</td>
							</tr>
							<tr>
								<td><b> Town:</b></td>
								<td>
									<%
										out.print(user.getCity());
									%>
								</td>
						</table>
					</div>
					<div class=field style="width: 262px;">
									<table style="height: 83px; width: 256px; background-color: #8080C0; border-top-style: solid; border-right-width: thin; border-right-style: solid; border-top-width: thin; border-top-color: #8080FF; border-right-color: #8080FF">
							<tr>
								<td style="background-color: #8080FF">Abilities</td>
								<td style="background-color: #8080FF">Rating</td>
								<td style="background-color: #8080FF">Feedback</td>
							</tr>
							<%
								for (Declares ability : abilities) {
									out.println("<tr> <td><b>"
											+ ability.getKey().getAbility().getName()
											+ "</b> </td>");
									out.println("<td><b>" + ability.getRating() + "</b> </td>");
									out.println("<td><b>" + ability.getNumberOfFeedbacks()
											+ "</b> </td></tr>");
								}
							%>
						</table>
					</div>
				</fieldset>
			</form>
		</div>
	</fieldset>



</body>

</html>